package com.leesche.zcsp.node.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.leesche.zcsp.node.web.dao.SysRoleDao;
import com.leesche.zcsp.node.web.model.SysRole;
import com.leesche.zcsp.node.web.model.SysRoleCriteria;
import com.leesche.zcsp.node.web.model.SysUser;
import com.leesche.zcsp.node.web.service.SysRoleService;
import com.leesche.zcsp.node.web.service.impl.data.read.QuerySysRoleCondition;
import com.leesche.zcsp.node.web.service.impl.data.read.SysRoleDto;
import com.leesche.zcsp.node.web.service.impl.data.read.SysUserDto;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Title: SysRoleServiceImpl.java
 * @Description: TODO(调度SysRoleDao、SysRoleModuleDao的数据表操作)
 * @author 陈立勇
 * @date 2016年9月14日 下午2:25:08
 * @version V1.0
 */
@Service
@Transactional
public class SysRoleServiceImpl
		extends
		BaseServiceImpl<SysRole, SysRoleCriteria, SysRoleDto, QuerySysRoleCondition, Long>
		implements SysRoleService {
	@Autowired
	private SysRoleDao sysRoleDao;

	@Autowired
	public void setBaseDao(SysRoleDao sysRoleDao) {
		super.setBaseDao(sysRoleDao);
	}

	@Override
	public List<SysRole> findSysRoleParentTree() {
		// TODO Auto-generated method stub return null;
		return sysRoleDao.selectByParentTree();
	}

	@Override
	public List<SysRole> findSysUserRole(List<SysUser> sysUsers) {
		// TODO Auto-generated method stub return null;
		return sysRoleDao.selectByRoleNtypes(sysUsers);
	}

	@Override
	public List<SysRole> findSysRoleByDifferentUser(SysUserDto sysUserDto) {
		// TODO Auto-generated method stub return null;
		return sysRoleDao.selectByDifferentUser(sysUserDto);
	}

	@Override
	public int countRoleTotal() {
		// TODO Auto-generated method stub return 0;
		return sysRoleDao.selectRoleTotal();
	}

	@Override
	public List<SysRole> findChildRoleByBusinessUserID(Long userid) {
		return sysRoleDao.selectChildRoleByBusinessUser(userid);
	}

	@Override
	public List<SysRole> findChildRolesByCondition(QuerySysRoleCondition condition) {
		return sysRoleDao.selectChildRoleByCondition(condition);
	}
}
